#include <iostream>
#include <cmath>

//辗转相除法
int gcd(int x, int y)
{   
    int max = std::max(x, y);
    int min = std::min(x, y);
    //取余
    int r = max % min;
    while(r != 0)
    {
        max = min;
        min = r;
        r = max % min;
    }
    return min;
}
class Point
{
private:
    int x;
    int y;

public:

    Point(int x, int y)
    {
        this->x = x;
        this->y = y;
    }
    
    void show()
    {
        std::cout<<"("<<x<<","<<y<<")"<<std::endl;
    }

    //友元函数
    friend double Distance(const Point& p1, const Point& p2);
    //友元类
    friend class Line;
};

double Distance(const Point& p1, const Point& p2)
{
    return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
}

class Line
{
private:
    double A;
    double B;
    double C;
    
public:
    Line(double A, double B, double C):A(A), B(B), C(C){}
    Line(const Point& p1, const Point& p2)
    {
        A = p1.y - p2.y;
        A = p2.x - p1.x;
        A = p1.x * p2.y - p1.y * p2.x;

        int r =gcd(gcd(A,B), C);
        std::cout<<r<<std::endl;
        A /= r;
        B /= r;
        C /= r;
    }
};

class Circle
{
private:
    Point p;
    int len;

};
int main()
{
    Point p1(1,2);
    Point p2(1,4);

    p1.show();
    
    std::cout<<"p1和p2的距离:"<<Distance(p1, p2)<<std::endl;
    return 0;
}